<?php
/**
 * Created by PhpStorm.
 * User: 快定
 * Date: 2022/2/24
 * Time: 21:27
 */

class Single
{
    private static $instance;

    private function __construct()
    {
    }

    private function __clone()
    {
        // TODO: Implement __clone() method.
    }

    public static function getInstance()
    {
        if (!self::$instance instanceof self) {
                self::$instance = new self();
        }
        return self::$instance;
    }
}


$obj1 = Single::getInstance();
$obj2 = Single::getInstance();

var_dump($obj1);
var_dump($res);
